/**
 * @file AC 自动机
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @brief
 * @version 1.0
 * @date 2022-05-08
 *
 * @copyright Copyright (c) 2022
 *
 **/
#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
queue<int> q;
struct AhoSorasickAutomata {
  int c[N][26], val[N], fail[N], cnt;
  void insert(char *s) {
    int len = strlen(s);
    int now = 0;
    for (int i = 0; i < len; ++i) {
      int v = s[i] - 'a';
      if (!c[now][v]) c[now][v] = ++cnt;
      now = c[now][v];
    }
    val[now]++;
  }
  void build() {
    for (int i = 0; i < 26; ++i) {
      if (c[0][i]) {
        fail[c[0][i]] = 0, q.push(c[0][i]);
      }
    }
    while (q.size()) {
      int u = q.front();
      q.pop();
      for (int i = 0; i < 26; ++i) {
        if (c[u][i]) {
          fail[c[u][i]] = c[fail[u]][i];
          q.push(c[u][i]);
        } else {
          c[u][i] = c[fail[u]][i];
        }
      }
    }
  }
  int query(char *s) {
    int len = strlen(s);
    int now = 0, ans = 0;
    for (int i = 0; i < len; ++i) {
      now = c[now][s[i] - 'a'];
      for (int t = now; t && ~val[t]; t = fail[t]) {
        ans += val[t];
        val[t] = -1;
      }
    }
    return ans;
  }
} AC;
int n;
char p[1000005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%s", p), AC.insert(p);
  AC.build();
  scanf("%s", p);
  int ans = AC.query(p);
  printf("%d\n", ans);
  return 0;
}
